﻿--3 - Найти человека по контакту
/*

*/

select [LastName], [Name] from [MyFamily].[dbo].[Persons]
where [ID] in 
(select [fk_PersonID]
 from  [MyFamily].[dbo].[Contact] where [ContactValue] ='999')

select [MyFamily].[dbo].[Persons].[LastName], [MyFamily].[dbo].[Persons].[Name]
from [MyFamily].[dbo].[Persons], [MyFamily].[dbo].[Contact]
where [MyFamily].[dbo].[Persons].[ID] = [MyFamily].[dbo].[Contact].[fk_PersonID] and 
 [MyFamily].[dbo].[Contact].[ContactValue] ='999'